#ifndef _EPDFUNC_H_
#define _EPDFUNC_H_

#include "xz_common.h"

#include "e-Paper/DEV_Config.h"
#include "e-Paper/EPD.h"



#if defined(EPD154C1)
#define EPD_COLOR 2
// #define  EPD_WIDTH	EPD_1IN54_WIDTH
// #define  EPD_HEIGHT	EPD_1IN54_HEIGHT
#define  EPD_WIDTH	EPD_1IN54_Grey_WIDTH
#define  EPD_HEIGHT	EPD_1IN54_Grey_HEIGHT
#define  EPD_MODEL	"EPD154C1"
#elif defined(EPD154Z91)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_1IN54B_Z91_WIDTH
#define  EPD_HEIGHT	EPD_1IN54B_Z91_HEIGHT
#define  EPD_MODEL	"EPD154Z91"
#elif defined(EPD154Z17)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_1IN54B_Z17_WIDTH
#define  EPD_HEIGHT	EPD_1IN54B_Z17_HEIGHT
#define  EPD_MODEL	"EPD154Z17"
#elif defined(EPD290Z94)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_2IN9B_Z94_Grey_WIDTH
#define  EPD_HEIGHT	EPD_2IN9B_Z94_Grey_HEIGHT
#define  EPD_MODEL	"EPD290Z94"
#elif defined(EPD266Z90)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_2IN66B_Z90_Grey_WIDTH
#define  EPD_HEIGHT	EPD_2IN66B_Z90_Grey_HEIGHT
#define  EPD_MODEL	"EPD266Z90"
#elif defined(EPD420Z99)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_4IN2B_Z99_WIDTH
#define  EPD_HEIGHT	EPD_4IN2B_Z99_HEIGHT
#define  EPD_MODEL	"EPD420Z99"
#elif defined(EPD583Z83)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_5IN83B_Z83_WIDTH
#define  EPD_HEIGHT	EPD_5IN83B_Z83_HEIGHT
#define  EPD_MODEL	"EPD583Z83"
#elif defined(EPD266H850)
#define EPD_COLOR 3
#define  EPD_WIDTH	EPD_2IN66B_H850_Grey_WIDTH
#define  EPD_HEIGHT	EPD_2IN66B_H850_Grey_HEIGHT
#define  EPD_MODEL	"EPD266H850"
#elif defined(EPD154A05)
#define EPD_COLOR 2
#define  EPD_WIDTH	EPD_1IN54_A05_WIDTH
#define  EPD_HEIGHT	EPD_1IN54_A05_HEIGHT
#define  EPD_MODEL	"EPD154A05"
#elif defined(EPD270T91)
#define EPD_COLOR 2
#define  EPD_WIDTH	EPD_2IN7_T91_WIDTH
#define  EPD_HEIGHT	EPD_2IN7_T91_HEIGHT
#define  EPD_MODEL	"EPD270T91"
#endif

#define EPD_DISPLAY_FULL 0
#define EPD_DISPLAY_PART 1
#define EPD_DISPLAY_Grey_Bwr4   2
#define EPD_DISPLAY_Grey_Bwr8   3
#define EPD_DISPLAY_Grey_Bwr16  4

extern uint8_t greyscale;


#ifdef __cplusplus
extern "C"
{
#endif
    
    void eink_inti(uint8_t lut_type=EPD_DISPLAY_FULL);
    void EpdCmdWrite(uint8_t *data, int data_length);
    void eink_display(uint8_t *image_black_buffer=NULL,uint8_t *image_red_buffer=NULL);
    void eink_image_length_reset(void);
    // void eink_grey_inti(void);
    bool eink_grey_display(int depth);
    void eink_grey_display_end(void);
    void epd_data_write(uint8_t color, uint8_t *Image_Data, uint32_t index, uint32_t length);
    void eink_grey_data_inti(void);
    void eink_clear(void);
    bool eink_grey_bwr_display(int depth);
    void eink_TurnOnDisplay(uint8_t part=EPD_DISPLAY_FULL);
    void eink_setDepth(uint8_t i);


#ifdef __cplusplus
}
#endif

#endif
